/**
 * Copyright (c) 2014, 2017, Oracle and/or its affiliates.
 * The Universal Permissive License (UPL), Version 1.0
 */
"use strict";
define(["ojs/ojcore","jquery","ojs/ojcomponentcore","ojs/ojvalidation","ojs/internal-deps/dvt/DvtToolkit","ojdnd","promise"],function(a,g,b,c,d){function e(a,b){this.gBa=b;this.fDa=a;this.Msa="/"}a.wk=function(a){this.Init(a)};o_("AttributeGroupHandler",a.wk,a);a.b.sa(a.wk,a.b,"oj.AttributeGroupHandler");a.wk.prototype.Init=function(a){this.uC={};this.aM=0;this.CV={};for(var b in a)this.RX(b,a[b])};a.wk.prototype.Kn=function(){return[]};a.b.g("AttributeGroupHandler.prototype.getValueRamp",{Kn:a.wk.prototype.Kn});
a.wk.prototype.ie=function(a){if(this.CV[a])return this.CV[a];this.uC[a]||(this.Sg||(this.Sg=this.Kn().slice()),this.uC[a]=this.Sg[this.aM],this.aM++,this.aM==this.Sg.length&&(this.aM=0));return this.uC[a]};a.b.g("AttributeGroupHandler.prototype.getValue",{ie:a.wk.prototype.ie});a.wk.prototype.dga=function(){var a=[],b;for(b in this.uC)a.push({category:b,value:this.uC[b]});return a};a.b.g("AttributeGroupHandler.prototype.getCategoryAssignments",{dga:a.wk.prototype.dga});a.wk.prototype.RX=function(a,
b){this.CV[a]=b};a.b.g("AttributeGroupHandler.prototype.addMatchRule",{RX:a.wk.prototype.RX});a.Mx=function(a){this.Init(a)};o_("ShapeAttributeGroupHandler",a.Mx,a);a.b.sa(a.Mx,a.wk,"oj.ShapeAttributeGroupHandler");a.Mx.vC="square circle diamond plus triangleDown triangleUp human".split(" ");a.Mx.prototype.Kn=function(){return a.Mx.vC};a.b.g("ShapeAttributeGroupHandler.prototype.getValueRamp",{Kn:a.Mx.prototype.Kn});e.prototype.WCa=function(a,b,c,d){for(var e={};a&&-1<b.indexOf(c);){var f=b.substring(0,
b.indexOf(c));d&&void 0===a[f]&&(a[f]={});a=a[f];b=b.substring(b.indexOf(c)+1,b.length)}a&&(e.object=a,e.parameter=b);return e};e.prototype.yca=function(a){void 0===this.VD&&(a=this.WCa(this.fDa,this.gBa,this.Msa,a),this.VD=a.object,this.PV=a.parameter)};e.prototype.ie=function(){this.yca(!1);return void 0===this.VD?void 0:this.VD[this.PV]};e.prototype.aka=function(a,b){this.yca(!0);if(b||!this.VD[this.PV])this.VD[this.PV]=a};a.ug=function(b){this.vC=[];if(g(document.body).hasClass("oj-hicontrast"))this.vC=
a.ug.T1.slice();else{if(!a.ug.IC){a.ug.IC=[];var c=g(document.createElement("div"));c.attr("style","display:none;");c.attr("id","attrGps");g(document.body).append(c);for(var d=0;d<a.ug.k3.length;d++){var e=g(document.createElement("div"));e.addClass(a.ug.k3[d]);c.append(e);(e=e.css("color"))&&a.ug.IC.push(e)}c.remove()}this.vC=0<a.ug.IC.length?a.ug.IC.slice():a.ug.T1.slice()}this.Init(b)};o_("ColorAttributeGroupHandler",a.ug,a);a.b.sa(a.ug,a.wk,"oj.ColorAttributeGroupHandler");a.ug.T1="#267db3 #68c182 #fad55c #ed6647 #8561c8 #6ddbdb #ffb54d #e371b2 #47bdef #a2bf39 #a75dba #f7f37b".split(" ");
a.ug.k3="oj-dvt-category1 oj-dvt-category2 oj-dvt-category3 oj-dvt-category4 oj-dvt-category5 oj-dvt-category6 oj-dvt-category7 oj-dvt-category8 oj-dvt-category9 oj-dvt-category10 oj-dvt-category11 oj-dvt-category12".split(" ");a.ug.IC=null;a.ug.prototype.Kn=function(){return this.vC};a.b.g("ColorAttributeGroupHandler.prototype.getValueRamp",{Kn:a.ug.prototype.Kn});var f={CSS_TEXT_PROPERTIES:function(a){var b={};a&&(a.hasClass("oj-gauge-metric-label")&&a.hasClass(a.parentNode,"oj-ledgauge")?(b["font-size"]=
!0,b.color=!0):a.hasClass(a,"oj-chart-slice-label")?b.color=!0:a.hasClass("oj-treemap-node-header")&&(b["font-weight"]=!0));return f.Dqa(a,b)},CSS_BACKGROUND_PROPERTIES:function(a){return f.vqa(a)},CSS_URL:function(a){return f.fBa(a)},m2:"rgb(254, 0, 254)",fna:"Times",gna:"1px",o2:"1",n2:"normal",Zma:4,DL:{},pHa:function(a,b){return a.css(b)},fBa:function(a){return(a=a.css("background-image"))&&-1!==a.indexOf("url(")?a.slice(a.indexOf("url(")+4,a.length-1).replace(/"/g,""):a},vqa:function(a){var b=
{};a.css("border-top-color")&&(b["border-color"]=a.css("border-top-color"));a.css("border-width")&&a.css("border-style")&&"none"!=a.css("border-style")&&(b["border-width"]=a.css("border-width"));a.css("background-color")&&(b["background-color"]=a.css("background-color"));return b},Dqa:function(a,b){var c={},d=a.css("font-family");d&&d!==f.fna&&(c["font-family"]=d.replace(/"/g,"'"));d=a.css("font-size");!d||-1<d.indexOf("px")&&parseFloat(d)<f.Zma||b["font-size"]||(c["font-size"]=d);(d=a.css("font-weight"))&&
d!==f.o2&&!b["font-weight"]&&(c["font-weight"]=d);(d=a.css("color"))&&d!==f.m2&&!b.color&&(c.color=d);(d=a.css("font-style"))&&d!==f.n2&&(c["font-style"]=d);return c},EKa:function(a,b,c,d){var e=g(document.createElement("div"));e.attr("style","display:none;");a.append(e);a="";for(var t=0;t<c.length;t++)a=a+c[t]+" ";e.attr("class",a);g(document.body).append(e);c=g(document.createElement("div"));c.css("font-size",f.gna);c.css("color",f.m2);c.css("font-weight",f.o2);c.css("font-style",f.n2);e.append(c);
for(var s in d)a=d[s],a instanceof Array||(a=[a]),f.DBa(c,b,s,a);e.remove()},DBa:function(a,b,c,d){f.DL[c]||(f.DL[c]={});for(var r=null,t=0;t<d.length;t++){var s=d[t],q=s.property;if(q){var p=f.DL[c][q];"undefined"==typeof p&&(r||(r=g(document.createElement("div")),r.addClass(c),a.append(r)),p=f.XCa(r,q),f.DL[c][q]=p);if(null!=p){var s=new e(b,s.path),n=f[q];if(null!=n){var u=s.ie();if("CSS_URL"!==q){q="";if(null!=u){var u=f.Tva(u),v;for(v in p)-1===u.indexOf(v)&&(q+=v+":"+p[v]+";");q+=u}else for(v in p)q+=
v+":"+p[v]+";";p=q}}s.aka(p,null!=n)}}}},Tva:function(a){if(a instanceof Object){var b="",c;for(c in a)var d=c.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),b=b+(d+":"+a[c]+";");return b}return null!=a&&"string"==typeof a?a:""},XCa:function(a,b){var c=f[b],c=c?c(a):f.pHa(a,b);return null==c||"string"==typeof c&&""==c.replace(/^\s+/g,"")?null:c}};a.Ra("oj.dvtBaseComponent",g.oj.baseComponent,{_ComponentCreate:function(){this._super();this.gE=this.pW=0;this.Xo=null;for(var b=this.Jf(),c=0;c<b.length;c++)this.element.addClass(b[c]);
this.ZK=g(document.createElement("div"));this.ZK.attr("style","visibility:hidden;");this.element.append(this.ZK);this.bg=(b=this.element[0].parentElement)&&b.UC?b.UC:new d.Context(this.element[0],null,this.ZK[0]);this.bg.setReadingDirection(this.nd());this.bg.setTooltipAttachedCallback(a.Components.rg);this.bg.setOverlayAttachedCallback(a.Components.rg);this.bg.setTooltipStyleClass("oj-dvt-tooltip");this.bg.setDatatipStyleClass("oj-dvt-datatip");this.bg.setDefaultFontFamily(this.ZK.css("font-family"));
g(document.body).hasClass("oj-hicontrast")&&d.Agent.setHighContrast(!0);this.xa=this.Dg(this.bg,this.El,this);this.bg.getStage().addChild(this.xa);!1!==d.requireJS&&(this.YDa(),this.yba());this.Tm();this.options._environment="jet";this.options._widgetConstructor=a.Components.Yc(this.element)},Nh:function(){this._super();this.element.attr("tabIndex",0);"off"!=this.options.trackResize&&this.cR();this.sba();this.Sh()},refresh:function(){this._super();this.bg.setReadingDirection(this.nd());this.yba();
this.Sh()},getNodeBySubId:function(a){var b=this.xa&&this.xa.getAutomation?this.xa.getAutomation():null;if(b)return a=this.Hk(a),b.getDomElementForSubId(a)},getSubIdByNode:function(a){var b=this.xa&&this.xa.getAutomation?this.xa.getAutomation():null;if(b)return(a=b.getSubIdForDomElement(a))?this.Oh(a):null},Hk:function(){return null},Oh:function(){return null},KH:function(){f.EKa(this.element,this.options,this.Jf(),this.Ej())},Jf:function(){return["oj-dvtbase"]},Ej:function(){return{"oj-dvt-no-data-message":{path:"_statusMessageStyle",
property:"CSS_TEXT_PROPERTIES"}}},Fj:function(){return[]},Ti:function(){var b=this.options.translations,b={"DvtUtilBundle.CLEAR_SELECTION":b.labelClearSelection,"DvtUtilBundle.COLON_SEP_LIST":b.labelAndValue,"DvtUtilBundle.INVALID_DATA":b.labelInvalidData,"DvtUtilBundle.NO_DATA":b.labelNoData,"DvtUtilBundle.DATA_VISUALIZATION":b.labelDataVisualization,"DvtUtilBundle.STATE_SELECTED":b.stateSelected,"DvtUtilBundle.STATE_UNSELECTED":b.stateUnselected,"DvtUtilBundle.STATE_MAXIMIZED":b.stateMaximized,
"DvtUtilBundle.STATE_MINIMIZED":b.stateMinimized,"DvtUtilBundle.STATE_EXPANDED":b.stateExpanded,"DvtUtilBundle.STATE_COLLAPSED":b.stateCollapsed,"DvtUtilBundle.STATE_ISOLATED":b.stateIsolated,"DvtUtilBundle.STATE_HIDDEN":b.stateHidden,"DvtUtilBundle.STATE_VISIBLE":b.stateVisible,"DvtUtilBundle.SCALING_SUFFIX_THOUSAND":b.labelScalingSuffixThousand,"DvtUtilBundle.SCALING_SUFFIX_MILLION":b.labelScalingSuffixMillion,"DvtUtilBundle.SCALING_SUFFIX_BILLION":b.labelScalingSuffixBillion,"DvtUtilBundle.SCALING_SUFFIX_TRILLION":b.labelScalingSuffixTrillion,
"DvtUtilBundle.SCALING_SUFFIX_QUADRILLION":b.labelScalingSuffixQuadrillion},c=a.$a.wF("abbreviated");b["DvtUtilBundle.MONTH_SHORT_JANUARY"]=c[0];b["DvtUtilBundle.MONTH_SHORT_FEBRUARY"]=c[1];b["DvtUtilBundle.MONTH_SHORT_MARCH"]=c[2];b["DvtUtilBundle.MONTH_SHORT_APRIL"]=c[3];b["DvtUtilBundle.MONTH_SHORT_MAY"]=c[4];b["DvtUtilBundle.MONTH_SHORT_JUNE"]=c[5];b["DvtUtilBundle.MONTH_SHORT_JULY"]=c[6];b["DvtUtilBundle.MONTH_SHORT_AUGUST"]=c[7];b["DvtUtilBundle.MONTH_SHORT_SEPTEMBER"]=c[8];b["DvtUtilBundle.MONTH_SHORT_OCTOBER"]=
c[9];b["DvtUtilBundle.MONTH_SHORT_NOVEMBER"]=c[10];b["DvtUtilBundle.MONTH_SHORT_DECEMBER"]=c[11];return b},yba:function(){var a=this.Ti();d.Bundle.addLocalizedStrings(a)},YDa:function(){var b={};b.numberConverterFactory=a.za.nga("number");b.dateToIsoConverter=function(b){return b instanceof Date?a.Na.dateToLocalIso(b):b};b.isoToDateConverter=function(b){if("string"==typeof b){var c=a.Na.isoToDate(b);b=c.toJSON()?a.Na.dateToLocalIso(c):b;return a.Na.isoToLocalDate(b)}return b};b.dateToIsoWithTimeZoneConverter=
function(b){if(b instanceof Date){var c=-1*b.getTimezoneOffset(),d=Math.floor(Math.abs(c)/60),e=Math.abs(c)%60,c=(0<=c?"+":"-")+(2!==d.toString().length?"0"+d:d)+":"+(2!==e.toString().length?e+"0":e);return a.Na.dateToLocalIso(b)+c}return b};this.bg.setLocaleHelpers(b)},_destroy:function(){this.bg.hideTooltips();this.bg=null;var a=this.element[0].parentElement;a&&a.UC&&(a.UC=null);this.xa.destroy&&this.xa.destroy();this.xa=null;this.lW();this.element.children().remove();this.element.removeAttr("role").removeAttr("tabIndex").removeAttr("aria-activedescendant");
for(var a=this.Jf(),b=0;b<a.length;b++)this.element.removeClass(a[b]);this._super()},_setOptions:function(a,b){this._superApply(arguments);var c=this.options.trackResize;"off"==c&&this.Xl?this.lW():"off"==c||this.Xl||this.cR();this.sba();if(!this.z4){var d=!1,e=this.Fj(),f=["highlightedCategories","selection","dataCursorPosition"];g.each(a,function(a){if(0>e.indexOf(a)&&0>f.indexOf(a))return d=!0,!1});d?this.Sh():(void 0!==a.highlightedCategories&&this.xa.highlight(a.highlightedCategories),void 0!==
a.selection&&this.xa.select(a.selection),void 0!==a.dataCursorPosition&&this.xa.positionDataCursor&&this.xa.positionDataCursor(a.dataCursorPosition))}},Dg:function(){return null},El:function(a){var b=a.type;"selection"===b?this.fe("selection",a.selection):"categoryHide"===b||"categoryShow"===b?this.fe("hiddenCategories",a.hiddenCategories):"categoryHighlight"===b?this.fe("highlightedCategories",a.categories):"optionChange"===b?this.fe(a.key,a.value,a.optionMetadata):"touchHoldRelease"===b&&this.options.contextMenu?
this.qh(g.Event(a.nativeEvent),"touch"):"ready"===b&&0===this.gE&&(this.$V&&this.$V(!0),this.Bba=!0,this.ZV=this.$V=null)},cR:function(){this.Xl||(this.Xl=this.Lg.bind(this),a.D.$k(this.element[0],this.Xl,250))},lW:function(){this.Xl&&(a.D.xm(this.element[0],this.Xl),this.Xl=null)},Lg:function(){var a=this.element.width(),b=this.element.height();(null==this.bM||null==this.hK||5<=Math.abs(a-this.bM)+Math.abs(b-this.hK))&&this.Sh(!0)},Tm:function(){},Sh:function(b){this.bg.hideTooltips();this.O2();
this.bg.isReadyToRender()?(this.bM=this.tH()?null:this.element.width(),this.hK=this.tH()?null:this.element.height(),this.options._width=this.bM,this.options._height=this.hK,this.options._locale=a.fa.hj(),this.options.dnd&&this.element.attr("draggable",!0),this.KH(),this.pW++,b?this.Xo||this.nW(null):0===this.VCa().length&&this.nW(this.options),this.rW=!1):this.rW=!0},hq:function(){this._super();this.rW&&this.Sh()},gq:function(){this._super();this.rW&&this.Sh()},Gj:function(){this._super();this.bg.hideTooltips()},
Vm:function(){this._super();this.bg.hideTooltips()},fe:function(a,b,c){this.z4=!0;this.option(a,b,{_context:{Cd:!0,$t:c,kb:!0}});this.z4=!1},ph:function(a,b,c){if("touch"!==c)if("keyboard"===c){a=this.element[0].getBoundingClientRect();var d=this.xa.getKeyboardFocus()?this.xa.getKeyboardFocus().getBoundingClientRect():null;this.qh(b,c,{position:{at:d?"left+"+(d.left+.5*d.width-a.left)+" top+"+(d.top+.5*d.height-a.top):"center"}})}else this._super(a,b,c)},VB:function(b){return(b=a.Components.Yc(b)("instance"))?
b.xa:null},Ri:function(a){if(a){var b={},c;for(c in a)this.upa(a,c,b);Object.defineProperties(a,b)}},upa:function(a,b,c){var d=("selected"==b?"is":"get")+b.charAt(0).toUpperCase()+b.slice(1);c[d]={value:function(){return a[b]}}},Pu:function(a){for(var b="",c=0;c<a.length;c++)b+="["+a[c]+"]";return b},Qm:function(a){for(var b=[],c=0;0<a.indexOf("[",c);){var d=a.indexOf("[",c)+1,c=a.indexOf("]",c);b.push(Number(a.substring(d,c)));c+=1}return b},Jk:function(a){return Number(this.nH(a))},nH:function(a){var b=
a.indexOf("[")+1,c=a.indexOf("]");return a.substring(b,c)},Ik:function(){return{}},VCa:function(){this.Xo=null;var a=this.Ik(),b;for(b in a)for(var c=a[b],d=0;d<c.length;d++)if("root"===b){if(this.iv(this.options,c[d]))break}else{var e=this.options[b];if(e)for(var f=0;f<e.length&&!this.iv(e[f],c[d]);f++);}var g=[];this.gE=0;if(this.Xo){var q=this;for(b in a)c=a[b],c.forEach(function(a){var c;if("root"===b)(c=q.G8(q.Xo,a))&&g.push(c);else{var d=q.Xo[b];if(d)for(var e=0;e<d.length;e++)(c=q.G8(d[e],
a))&&g.push(c)}})}return g},iv:function(a,b){if(!this.Xo){var c=(new e(a,b)).ie();c&&(c instanceof Function||c instanceof Promise)&&(this.Xo=d.JsonUtils.clone(this.options))}return null!==this.Xo},G8:function(a,b){var c=new e(a,b),d=c.ie();d instanceof Function&&(d=Promise.resolve(d(this.i2(a))));if(d&&d instanceof Promise){this.gE++;var f=this.pW,g=this;d.then(function(a){g.jca(f,c,a)},function(){g.jca(f,c,[])});return d}return null},jca:function(a,b,c){a===this.pW&&(this.gE--,b.aka(c,!0),0===this.gE&&
(this.nW(this.Xo),this.Xo=null))},nW:function(a){var b=this.tH()&&this.Xl;b&&this.lW();this.xa.render(a,this.bM,this.hK);b&&this.cR()},i2:function(){return{}},tH:function(){return!1},whenReady:function(){if(this.Bba)return Promise.resolve(!0);if(!this.ZV){var a=this;this.ZV=new Promise(function(b){a.$V=b})}return this.ZV},O2:function(){this.Bba=!1},sba:function(){var a=this.options.tooltip;"function"===typeof a&&(this.options.tooltip={renderer:a})}},!0);a.Components.Xa("dvtBaseComponent","baseComponent",
{properties:{trackResize:{type:"string"}},methods:{whenReady:{}},extension:{_widgetName:"dvtBaseComponent"}})});